﻿#pragma once

#include <bitset>
#include <optional>
#include <functional>
#include <excpt.h>

#include <string>
#include <fast_io/fast_io.h>

#include <fast_io/fast_io_dsal/vector.h>

#include "../Utils/HCNMath.h"
#include "../Utils/Utils.h"

#include "CAttribute.h"
#include "CBlockLegacy.h"
#include "CEntityList.h"
#include "CInventory.h"
#include "CInventoryTransaction.h"
#include "TextHolder.h"
#include "Dimension.h"

class C_GameMode;

class Level {
private:
	[[maybe_unused]] uint8_t firstpad[0x688]{};  // 0x8
public:
	int levelTicks{};  // 0x690
private:
	[[maybe_unused]] uint8_t secondpad[0x41C]{};  // 0x694
public:
	int rayHitType{};    // 0xAB0
	int blockSide{};     // 0xAB4
	vec3_ti block{};     // 0xAB8
	vec3_t rayHitVec{};  // 0xAC4
	// private:
	C_Entity *entityPtr{};          // 0xAD0
	C_Entity *entityPtr2{};         // 0xAD8
	uint64_t GamingEntityFinder{};  // 0xAE0

private:
	virtual void DONTREMOVEPLS(); //Vtable

	// public:
	//	bool hasEntity();       //to not go trough the entity list twice
	//	C_Entity *getEntity();  //returns the entity that the player is looking at
	//	int getLevelTicks() {
	//		//return levelTicks;
	//		return *reinterpret_cast<int *>(reinterpret_cast<__int64>(this) + 0x690);
	//	}
	//
	//	class C_LoopbackPacketSender *getLoopbackPacketSender() {
	//		return *reinterpret_cast<class C_LoopbackPacketSender **>(reinterpret_cast<__int64>(this) + 0xA90);
	//	}

public:
	/*
	 * 尽量不要使用以下函数不知道虚表地址是否正确！！！！！！！！！！！！！
	 */
#if 0
	virtual void initialize(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &, class LevelSettings const &, class LevelData *, class Experiments const &, std::basic_string<char, std::char_traits<char>, std::allocator<char>> const *);
	virtual void postProcessResources(void);
	virtual void startLeaveGame(void);
	virtual bool isLeaveGameDone(void);
	virtual void createDimension(uintptr_t);
	virtual Dimension *getDimension(class AutomaticID a0);
	virtual void forEachDimension(uintptr_t);
	virtual void forEachDimension2(uintptr_t);
	virtual int getChunkTickRange(void);
	virtual int getPortalForcer(void);
	virtual void requestPlayerChangeDimension(C_Entity &, std::unique_ptr<class ChangeDimensionRequest, std::default_delete<class ChangeDimensionRequest>>);
	virtual void entityChangeDimension(C_Entity &, class AutomaticID, class std::optional<vec3_t>);
	virtual int getSpawner(void);
	virtual int getProjectileFactory(void);
	virtual int getEntityDefinitions(void);
	virtual int getActorAnimationGroup(void);
	virtual int getActorAnimationControllerGroup(void);
	virtual int getBlockDefinitions(void);
	virtual int getBlockComponentFactory(void);
	virtual int getBlockComponentFactory2(void);
	virtual int getActorPropertyGroup(void);
	virtual int getSpawnRules(void);
	virtual int getSpawnGroupRegistry(void);
	virtual int getSpawnRulesMutable(void);
	virtual int getSpawnSettings(void);
	virtual void setSpawnSettings(class SpawnSettings const &);
	virtual int getBehaviorTreeGroup(void);
	virtual int getBehaviorFactory(void);
	virtual class Difficulty getDifficulty(void);
	virtual int getInternalComponentRegistry(void);
	virtual int getDimensionConversionData(void);
	virtual int getSpecialMultiplier(uintptr_t);
	virtual void hasCommandsEnabled(void);
	virtual void useMsaGamertagsOnly(void);
	virtual void setMsaGamertagsOnly(bool);
	virtual void registerEntity(uintptr_t);
	virtual C_Entity *addEntity(C_BlockSource &, class OwnerPtrT);
	virtual C_Entity *addGlobalEntity(C_BlockSource &, class OwnerPtrT);
	virtual void addAutonomousEntity(C_BlockSource &, uintptr_t);
	virtual void addUser(uintptr_t);
	virtual C_Entity *addDisplayEntity(C_BlockSource &, class OwnerPtrT);
	virtual void removeDisplayEntity(uintptr_t);
	virtual void suspendPlayer(C_Entity &);
	virtual void resumePlayer(C_Entity &);
	virtual bool isPlayerSuspended(C_Entity &);
	virtual void removeActorAndTakeEntity(class WeakEntityRef);
	virtual void takeEntity(WeakEntityRef, class LevelChunk *);
	virtual void fetchEntity(uint64_t, bool);
	virtual int getRuntimeEntity(class ActorRuntimeID, bool);
	virtual int getMob(uint64_t);
	virtual C_Player *getPlayer(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &);  // name or xuid only work on loacl world?
	virtual C_Player *getPlayer(class ActorUniqueID id);
	virtual C_Player *getPlayerByXuid(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &);
	virtual C_Player *getPlayerFromUnknownIdentifier(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &);
	virtual C_Player *getPlayer2(uint64_t);
	virtual int getPlatformPlayer(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &);
	virtual C_Player *getPlayerFromServerId(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &);
	virtual int getRuntimePlayer(ActorRuntimeID);
	virtual int getNumRemotePlayers(void);
	virtual int getPrimaryLocalPlayer(void);
	virtual int getRandomPlayer(void);
	virtual int getNewPlayerId(void);
	virtual int getEventing(void);
	virtual int getPlayerColor(C_Entity const &);
	virtual int getCurrentTick(void);
	virtual int getCurrentServerTick(void);
	virtual void removeAllNonPlayerEntities(uint64_t);
	virtual int getBiomeRegistry(void);
	virtual int getBiomeRegistry2(void);
	virtual int getBlockPalette(void);
	virtual int getBlockPalette2(void);
	virtual int getFeatureRegistry(void);
	virtual int getFeatureRegistry2(void);
	virtual int getFeatureTypeFactory(void);
	virtual int getFeatureTypeFactory2(void);
	virtual int getJigsawStructureRegistry(void);
	virtual int getJigsawStructureRegistry2(void);
	virtual int getStructureManager(void);
	virtual int getStructureManager2(void);
	virtual int getBiomeComponentFactory(void);
	virtual int getBiomeComponentFactory2(void);
	virtual int getSurfaceBuilderRegistry(void);
	virtual int getSurfaceBuilderRegistry2(void);
	virtual int getDimensionFactory(void);
	virtual int getDimensionFactory2(void);
	virtual int getLightTextureImageBuilderFactory(void);
	virtual int getLightTextureImageBuilderFactory2(void);
	virtual void addListener(class LevelListener &);
	virtual void removeListener(LevelListener &);
	virtual void tickEntities(void);
	virtual void tickEntitySystems(void);
	virtual int getPauseManager(void);
	virtual int getPauseManager2(void);
	virtual void onPlayerDeath(C_Entity &a1, class ActorDamageSource const &a2);
	virtual void tick(void);
	virtual void directTickEntities(C_BlockSource &);
	virtual void animateTick(C_Entity &);
	virtual void explode(C_BlockSource &, C_Entity *, vec3_t const &, float, bool, bool, float, bool);
	virtual void explode(class Explosion &);
	virtual bool createExplosion(vec3_t pos, int dimId, C_Entity *source, float radius, bool createFire, bool canBreak, float maxResistance = 3.40282347e+38);
	virtual void spawnParticleEffect(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &, vec3_t const &, class Dimension *);
	virtual void spawnParticleEffect2(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &, C_Entity const &, vec3_t const &);
	virtual void denyEffect(C_BlockSource &, vec3_t const &);
	virtual void potionSplash(vec3_t const &, struct MC_Color, bool);
	virtual void applyLiquidPhysicsToActor(C_Entity *, class MaterialType);
	virtual void extinguishFire(C_BlockSource &C_BlockSource, vec3_ti const &position, int blockSide);
	virtual void findPath(C_Entity &, int, int, int, class NavigationComponent &);
	virtual void findPath(C_Entity &, C_Entity &, class NavigationComponent &);
	virtual void updateSleepingPlayerList(void);
	virtual int getTime(void);
	virtual void setTime(int);
	virtual __int64 getSeed(void);
	virtual int getSharedSpawnPos(void);
	virtual void setDefaultSpawn(vec3_ti const &);
	virtual vec3_ti *getDefaultSpawn(void);
	virtual void setDefaultGameType(class GameType);
	virtual int getDefaultGameType(void);
	virtual void setDifficulty(class Difficulty);
	virtual void setMultiplayerGameIntent(bool);
	virtual int getMultiplayerGameIntent(void);
	virtual void setMultiplayerGame(bool);
	virtual bool isMultiplayerGame(void);
	virtual void setLANBroadcastIntent(bool);
	virtual int getLANBroadcastIntent(void);
	virtual void setLANBroadcast(bool);
	virtual int getLANBroadcast(void);
	virtual void setXBLBroadcastIntent(uintptr_t);
	virtual int getXBLBroadcastIntent(void);
	virtual void hasXBLBroadcastIntent(void);
	virtual void setXBLBroadcastMode(uintptr_t);
	virtual int getXBLBroadcastMode(void);
	virtual void hasXBLBroadcast(void);
	virtual void setPlatformBroadcastIntent(uintptr_t);
	virtual int getPlatformBroadcastIntent(void);
	virtual void hasPlatformBroadcastIntent(void);
	virtual void setPlatformBroadcastMode(uintptr_t);
	virtual int getPlatformBroadcastMode(void);
	virtual void hasPlatformBroadcast(void);
	virtual void setHasLockedBehaviorPack(bool);
	virtual void setHasLockedResourcePack(bool);
	virtual void setCommandsEnabled(bool);
	virtual void setWorldTemplateOptionsUnlocked(void);
	virtual void hasLevelStorage(void);
	virtual int getLevelStorage(void);
	virtual int getLevelStorage2(void);
	virtual int getLevelData(void);
	virtual int getLevelData2(void);
	virtual int getPhotoStorage(void);
	virtual void createPhotoStorage(void);
	virtual void setEducationLevelSettings(class EducationLevelSettings);
	virtual int getEducationLevelSettings(void);
	virtual void save(void);
	virtual void saveEducationLevelSettings(void);
	virtual void saveLevelData(void);
	virtual void saveGameData(void);
	virtual void saveVillages(void);
	virtual void savePlayers(void);
	virtual void savePlayer(C_Entity &);
	virtual void saveBiomeData(void);
	virtual void saveDirtyChunks(void);
	virtual void saveAdditionalData(void);
	virtual void requestTimedStorageDeferment(void);
	virtual void _checkUserStorage(void);
	virtual int getTickingAreasMgr(void);
	virtual int getTickingArea(uintptr_t);
	virtual void addParticle(class ParticleType, vec3_t const &, vec3_t const &, int, CompoundTag const *, bool);
	virtual void sendServerLegacyParticle(ParticleType, vec3_t const &, vec3_t const &, int);
	virtual void playSound(class LevelSoundEvent, vec3_t const &, int, class ActorDefinitionIdentifier const &, bool, bool);
	virtual void playSound(LevelSoundEvent, vec3_t const &, float, float);
	virtual void playSound(C_BlockSource &, LevelSoundEvent, vec3_t const &, int, ActorDefinitionIdentifier const &, bool, bool);
	virtual void playSynchronizedSound(C_BlockSource &, LevelSoundEvent, vec3_t const &, class C_Block const &, ActorDefinitionIdentifier const &, bool, bool);
	virtual void playSynchronizedSound(C_BlockSource &, LevelSoundEvent, vec3_t const &, int, ActorDefinitionIdentifier const &, bool, bool);
	virtual void setRemotePlayerEventCoordinator(std::unique_ptr<class PlayerEventCoordinator, std::default_delete<PlayerEventCoordinator>> &&);
	virtual int getRemotePlayerEventCoordinator(void);
	virtual void setServerPlayerEventCoordinator(std::unique_ptr<class ServerPlayerEventCoordinator, std::default_delete<ServerPlayerEventCoordinator>> &&);
	virtual int getServerPlayerEventCoordinator(void);
	virtual void setClientPlayerEventCoordinator(std::unique_ptr<class ClientPlayerEventCoordinator, std::default_delete<ClientPlayerEventCoordinator>> &&);
	virtual int getClientPlayerEventCoordinator(void);
	virtual void setActorEventCoordinator(std::unique_ptr<class ActorEventCoordinator, std::default_delete<ActorEventCoordinator>> &&);
	virtual int getActorEventCoordinator(void);
	virtual void setBlockEventCoordinator(std::unique_ptr<class BlockEventCoordinator, std::default_delete<BlockEventCoordinator>> &&);
	virtual int getBlockEventCoordinator(void);
	virtual void setItemEventCoordinator(std::unique_ptr<class ItemEventCoordinator, std::default_delete<ItemEventCoordinator>> &&);
	virtual int getItemEventCoordinator(void);
	virtual void setServerNetworkEventCoordinator(std::unique_ptr<class ServerNetworkEventCoordinator, std::default_delete<ServerNetworkEventCoordinator>> &&);
	virtual int getServerNetworkEventCoordinator(void);
	virtual int getLevelEventCoordinator(void);
	virtual void handleLevelEvent(class LevelEvent, vec3_t const &, int);
	virtual void handleLevelEvent(LevelEvent, CompoundTag const &);
	virtual void handleSoundEvent(LevelSoundEvent, vec3_t const &, int, ActorDefinitionIdentifier const &, bool, bool);
	virtual void handleSoundEvent(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &, vec3_t const &, float, float);
	virtual void handleStopSoundEvent(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &);
	virtual void handleStopAllSounds(void);
	virtual void broadcastLevelEvent(LevelEvent, vec3_t const &, int, class UserEntityIdentifierComponent const *);
	virtual void broadcastLevelEvent(LevelEvent, CompoundTag const &, UserEntityIdentifierComponent const *);
	virtual void broadcastLocalEvent(C_BlockSource &, LevelEvent, vec3_t const &, int);
	virtual void broadcastLocalEvent(C_BlockSource &, LevelEvent, vec3_t const &, C_Block const &);
	virtual void broadcastSoundEvent(C_BlockSource &, LevelSoundEvent, vec3_t const &, C_Block const &, ActorDefinitionIdentifier const &, bool, bool);
	virtual void broadcastSoundEvent(C_BlockSource &, LevelSoundEvent, vec3_t const &, int, ActorDefinitionIdentifier const &, bool, bool);
	virtual void broadcastActorEvent(C_Entity &, class ActorEvent, int);
	virtual void addBossEventListener(class BossEventListener *);
	virtual void removeBossEventListener(BossEventListener *);
	virtual void broadcastBossEvent(class BossEventUpdateType, uint64_t const &, class BossEventPacket const &);
	virtual void broadcastBossEvent(BossEventUpdateType);
	virtual void areBossEventListenersReady(void);
	virtual void addChunkViewTracker(std::weak_ptr<class ChunkViewSource>);
	virtual void pruneChunkViewTrackers(void);
	virtual void onChunkReload(struct Bounds const &);
	virtual void onChunkReloaded(class ChunkSource &, LevelChunk &);

private:
	virtual void TryroFunc210();

public:
	virtual __int64 getActivePlayerCount(void);
	virtual __int64 getActiveUsersCount(void);
	virtual void forEachPlayer(class std::function<bool(C_Player &)> callback);        //(std::function<bool()(Actor&)>);
	virtual void forEachPlayer(class std::function<bool(C_Player const &)> callback);  //(std::function<bool()(Actor const&)>);
	virtual std::vector<C_Player *> getAllPlayers();

	virtual void forEachUser(uintptr_t);  //(std::function<bool()(Actor&)>);
	virtual void findPlayer(uintptr_t);   //(std::function<bool()(Actor const&)>);
	virtual void findPlayer2(uintptr_t);  //(std::function<bool()(Actor const&)>);
	virtual __int64 getUserCount(void);
	virtual void countUsersWithMatchingNetworkId(class NetworkIdentifier const &);
	virtual int getUsers(void);
	virtual int getUsers2(void);
	virtual __int64 getEntities(void);
	virtual void onSubChunkLoaded(ChunkSource &, LevelChunk &, short);
	virtual void onChunkLoaded(ChunkSource &, LevelChunk &);
	virtual void onChunkDiscarded(LevelChunk &);
	virtual void queueEntityDestruction(uintptr_t, bool);
	virtual void removeEntityReferences(C_Entity &, bool);
	virtual void removeEntity(C_Entity &);
	virtual void removeEntity(WeakEntityRef);
	virtual void removeEntityIfExists(C_Entity *);
	virtual void forceRemoveEntity(C_Entity &);
	virtual void forceFlushRemovedPlayers(void);
	virtual void loadFunctionManager(void);
	virtual void levelCleanupQueueEntityRemoval(uintptr_t, bool);
	virtual void registerTemporaryPointer(class _TickPtr &);
	virtual void unregisterTemporaryPointer(_TickPtr &);
	virtual void destroyBlock(C_BlockSource &, vec3_ti const &, bool);
	virtual void upgradeStorageVersion(class StorageVersion);
	virtual void suspendAndSave(void);
	virtual void waitAsyncSuspendWork(void);
	virtual void _destroyEffect(vec3_ti const &, C_Block const &, int);
	virtual void addParticleEffect(class HashedString const &, vec3_t const &, class MolangVariableMap const &);
	virtual void addParticleEffect(HashedString const &, C_Entity const &, HashedString const &, vec3_t const &, MolangVariableMap const &);
	virtual void addTerrainParticleEffect(vec3_ti const &, C_Block const &, vec3_t const &, float, float, float);
	virtual void addTerrainSlideEffect(vec3_ti const &, C_Block const &, vec3_t const &, float, float, float);
	virtual void addBreakingItemParticleEffect(vec3_t const &, ParticleType, struct TextureUVCoordinateSet const &, bool);
	virtual int getNewUniqueID(void);
	virtual int getNextRuntimeID(void);
	virtual int getTickingOffsets(void);
	virtual int getClientTickingOffsets(void);
	virtual bool isExporting(void);
	virtual void setIsExporting(bool);
	virtual int getSavedData(void);
	virtual int getMapSavedData(uint64_t);
	virtual int getMapSavedData(CompoundTag const &);
	virtual int getMapSavedData(CompoundTag const *);
	virtual void requestMapInfo(uint64_t, bool);
	virtual void expandMapByID(uint64_t, bool);
	virtual void copyAndLockMap(uint64_t, uint64_t);
	virtual void createMapSavedData(uint64_t const &, vec3_ti const &, uintptr_t, int);
	virtual void createMapSavedData(std::vector<uint64_t, std::allocator<uint64_t>> const &, vec3_ti const &, uintptr_t, int);

private:
	virtual void TryroFunc262();
	virtual void TryroFunc263();

public:
	virtual void setLevelId(std::basic_string<char, std::char_traits<char>, std::allocator<char>>);
	virtual int getSyncTasksGroup(void);
	virtual int getIOTasksGroup(void);
	virtual int getClientResourcePackManager(void);
	virtual int getServerResourcePackManager(void);
	virtual int getTradeTables(void);
	virtual void addEntryToTagCache(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &);
	virtual void addEntriesToTagCache(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char>>>>);
	virtual void dropEntryFromTagCache(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &);
	virtual void clearTagCache(void);
	virtual void decrementTagCache(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &, uintptr_t, uintptr_t);
	virtual void incrementTagCache(std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &, uintptr_t, uintptr_t);
	virtual bool isEdu(void);
	virtual int getActorFactory(void);
	virtual int getActorFactory2(void);
	virtual int getActorInfoRegistry(void);
	virtual int getEntityRegistryOwner(void);
	virtual int getEntitySystems(void);
	virtual int getLevelEntity(void);
	virtual void _clientHandleAddOwnedEntity(class EntityNetId);
	virtual void _clientHandleAddWeakRefEntity(EntityNetId, uintptr_t);
	virtual void _clientHandleRemoveOwnedEntity(EntityNetId);
	virtual void _clientHandleRemoveWeakRefEntity(EntityNetId);
	virtual void runCommand(HashedString const &, class CommandOrigin &, class CommandOriginSystem, class CurrentCmdVersion);
	virtual void runCommand(class Command &, CommandOrigin &, CommandOriginSystem);
	virtual int getTagRegistry(void);
	virtual int getPlayerMovementSettings(void);
	virtual void setPlayerMovementSettings(class PlayerMovementSettings const &);
	virtual void canUseSkin(class SerializedSkin const &, NetworkIdentifier const &, uintptr_t, std::basic_string<char, std::char_traits<char>, std::allocator<char>> const &);
	virtual int getPositionTrackerDBClient(void);
	virtual int getPositionTrackerDBServer(void);
	virtual void flushRunTimeLighting(void);
	virtual void loadBlockDefinitionGroup(Experiments const &);
	virtual void initializeBlockDefinitionGroup(void);
	virtual int getUnknownBlockTypeRegistry(void);

private:
	virtual void TryroFunc299();

public:
	virtual bool isClientSide(void);
	virtual int getPlayerList(void);
	virtual int getPlayerList2(void);

private:
	virtual void TryroFunc303();
	virtual void TryroFunc304();

public:
	virtual int getActiveUsers(void);
	virtual int getRuntimeActorList(void);
	virtual int getGlobalActors(void);
	virtual int getAutonomousActors(void);
	virtual int getAutonomousLoadedEntities(void);
	virtual void removeAutonomousEntity(C_Entity &, LevelChunk *);
	virtual void notifySubChunkRequestManager(class SubChunkPacket const &);
	virtual int getSubChunkRequestManager(void);
	virtual void *getPacketSender(void);
	virtual void setPacketSender(class PacketSender *);
	virtual int getNetEventCallback(void);
	virtual void setNetEventCallback(class NetEventCallback *);
	virtual int getRandom(void);
	virtual int getThreadRandom(void);
	virtual int getHitResult(void);
	virtual int getLiquidHitResult(void);

private:
	virtual void TryroFunc321();

public:
	virtual void setImmersiveReaderString(std::basic_string<char, std::char_traits<char>, std::allocator<char>>);
	virtual int getAdventureSettings(void);
	virtual int getGameRules(void);
	virtual int getGameRules2(void);
	virtual void hasStartWithMapEnabled(void);
	virtual int getDefaultAbilities(void);
	virtual int getTearingDown(void);
	virtual void takePicture(uintptr_t, C_Entity *, C_Entity *, struct ScreenshotOptions &);
	virtual int getSoundPlayer(void);
	virtual void setSimPaused(bool);
	virtual int getSimPaused(void);
	virtual void setFinishedInitializing(void);
	virtual int getLootTables(void);
	virtual void updateWeather(float, int, float, int);
	virtual int getNetherScale(void);
	virtual int getScoreboard(void);
	virtual int getPlayerAbilities(uint64_t const &);
	virtual void setPlayerAbilities(uint64_t const &, class Abilities);
	virtual void sendAllPlayerAbilities(C_Entity const &);
	virtual void incrementSpawnableTickedMob(void);
	virtual int getSpawnableTickedMobCountPrevious(void);
	virtual int getRecipes(void);
	virtual int getBlockReducer(void);
	virtual void digestServerBlockProperties(class StartGamePacket const &, uintptr_t);
	virtual void digestServerItemComponents(class ItemComponentPacket const &);
	virtual int getRegisteredBorderBlock(void);
	virtual void asLevel(void);
	virtual void asMultiPlayerLevel(void);
	virtual void onSourceCreated(C_BlockSource &);
	virtual void onSourceDestroyed(C_BlockSource &);
	virtual void _localPlayerChangedDimension(void);
	virtual C_Entity *spawnMob(vec3_t pos, int dimId, std::u8string typeName);
	virtual C_Entity *spawnItem(vec3_t pos, int dimId, C_ItemStack *item);
	virtual bool setBlock(const vec3_ti &pos, int dim, C_Block *block);
	virtual bool setBlock(const vec3_ti &pos, int dim, const std::u8string &name, unsigned short tileData);
	virtual bool setBlock(const vec3_ti &pos, int dim, CompoundTag *nbt);
	virtual std::u8string getCurrentLevelName();
	virtual std::u8string getCurrentLevelPath();
	virtual int64_t createBossEvent();
	virtual bool executeCommandAs(C_Player *player, const std::u8string &cmd);
	virtual std::pair<bool, std::u8string> executeCommandEx(const std::u8string &cmd);
	virtual bool executeCommand(const std::u8string &cmd);

#endif  // 0

public:
	bool hasEntity() const;       // to not go trough the entity list twice
	C_Entity *getEntity() const;  // returns the entity that the player is looking at
	inline int getLevelTicks() {
		// return levelTicks;
		return *reinterpret_cast<int *>(reinterpret_cast<uintptr_t>(this) + 0x690);
	}

	inline class C_LoopbackPacketSender *getLoopbackPacketSender() {
		return *reinterpret_cast<class C_LoopbackPacketSender **>(reinterpret_cast<uintptr_t>(this) + 0xA90);
	}

	void playSound(std::u8string_view sound, vec3_t const &position, float volume, float pitch);

	// Credits to hacker hansen for this
	fast_io::vector<C_Entity *> getMiscEntityList();
};

class C_Player;
class Dimension;
struct MobEffectInstance;

#pragma pack(push, 4)
class C_Entity {
public:
	uint64_t ptrToEntityList{};  // 0x0008
private:
	[[maybe_unused]] uint8_t pad_0010[296]{};  // 0x0010
public:
	float pitch{};  // 0x0138
	float yaw{};    // 0x013C

	float pitch2{};  // 0x0138
	float yaw2{};    // 0x013C

private:
	[[maybe_unused]] uint8_t pad_0148[16]{};  // 0x0148
public:
	vec3_t eyePos0{};  // 0x0158
private:
	[[maybe_unused]] uint8_t pad_0164[112]{};  // 0x0164
public:
	float fallDistance{};         // 0x1D4
	bool onGround{};              // 0x1D8
	bool onGround2{};             // 0x1D9
	bool walkingIntoSomething{};  // 0x1DA
	bool actuallyOnGround{};      // 0x1DB
	bool touchingSomething{};     // 0x1DC
private:
	[[maybe_unused]] uint8_t pad_0x1DD[0x5B]{};  // 0x1DD
public:
	float stepHeight{};  // 0x0238
private:
	[[maybe_unused]] uint8_t pad_0x23C[0x4]{};  // 0x23C
public:
	float travelDistanceGroundOld{};  // 0x240
	float travelDistanceGround{};     // 0x244
	float travelDistance{};           // 0x248
	vec3_t slowdownFactor{};          // 0x24C
	float unk{};                      // 0x258
	bool IsInWater{};                 // 0x25C
	bool didEnterWaterBool{};         // 0x25D
	bool hasEnterWaterBool{};         // 0x25E
	bool isSwimming{};                // 0x25F
private:
	[[maybe_unused]] uint8_t pad_0x260[0x48]{};  // 0x260
public:
	int32_t ticksAlive{};  // 0x02A8
private:
	[[maybe_unused]] uint8_t pad_02AC[172]{};  // 0x02AC
public:
	C_BlockSource *region{};  // 0x0358
	Dimension *dimension{};   // 0x360
	Level *level{};           // 0x0368
private:
	[[maybe_unused]] uint8_t pad_0370[328]{};  // 0x0370
public:
	AABB aabb{};          // 0x04B8
	float width{};        // 0x04D0
	float height{};       // 0x04D4
	vec3_t currentPos{};  // 0x04D8
	vec3_t oldPos{};      // 0x04E4
	vec3_t velocity{};    // 0x04F0
	vec3_t velocity2{};   // 0x04FC
private:
	[[maybe_unused]] uint8_t pad_0508[80]{};  // 0x0508
public:
	int64_t entityRuntimeId{};  // 0x0558
private:
	[[maybe_unused]] uint8_t pad_0560[0x1C8]{};  // 0x0560
public:
	float bodyYaw{};                    // 0x0728
	float oldBodyYaw{};                 // 0xtoolazytoupdatethesecommentsxd
	float yawUnused1{};                 // 0x0748
	float yawUnused2{};                 // 0x074C
	int32_t damageTime{};               // 0x0750
	int32_t damageAnimationDuration{};  // 0x0754
private:
	[[maybe_unused]] uint8_t pad_0758[136]{};  // 0x0758
public:
	int32_t timeSinceDeath{};  // 0x07E0
private:
	[[maybe_unused]] uint8_t pad_07E4[244]{};  // 0x07E4
public:
	TextHolder playerName{};  // 0x08D8
private:
	[[maybe_unused]] uint8_t pad_0x8E0[0x80]{};  // 0x8E0
public:
	bool isFlying{};  // 0x960
private:
	[[maybe_unused]] uint8_t pad_0x961[0xB]{};  // 0x961
public:
	bool canFly{};  // 0x0984
private:
	[[maybe_unused]] uint8_t pad_0985[1667]{};  // 0x0985
public:
	int32_t ticksUsingItem{};  // 0x1008
private:
	[[maybe_unused]] uint8_t pad_100C[20]{};  // 0x100C
public:
	int16_t itemData{};  // 0x1020
	int16_t itemId{};    // 0x1022
private:
	[[maybe_unused]] uint8_t pad_1024[508]{};  // 0x1024
public:
	C_InventoryTransactionManager transac{};  // 0x1220
private:
	[[maybe_unused]] uint8_t pad_1280[2828]{};  // 0x1280
public:
	int32_t gamemode{};  // 0x1D8C
public:
	virtual bool hasComponent(class HashedString const &) const;                                   // 0
	virtual C_Entity *getLastHurtByMob();                                                          // 1
	virtual void setLastHurtByMob(C_Entity *);                                                     // 2
	virtual C_Player *getLastHurtByC_Player();                                                     // 3
	virtual void setLastHurtByPlayer(C_Player *);                                                  // 4
	virtual C_Entity *getLastHurtMob();                                                            // 5
	virtual void setLastHurtMob(C_Entity *);                                                       // 6
	virtual void outOfWorld();                                                                     // 7
	virtual void reloadHardcoded(class InitializationMethod, class VariantParameterList const &);  // 8
	virtual void reloadHardcodedClient(InitializationMethod, VariantParameterList const &);        // 9
	virtual void initializeComponents(InitializationMethod, VariantParameterList const &);         // 10
	virtual void reloadComponents(InitializationMethod, VariantParameterList const &);             // 11
	virtual void _serverInitItemStackIds();                                                        // 12
	virtual void _doInitialMove();                                                                 // 13
	virtual void destructorEntity();                                                               //~Centity()                                                  // 14
	virtual void reset(void);                                                                      // 15
	virtual void resetUserPos(bool);                                                               // 16
	virtual enum ActorType getOwnerEntityType();                                                   // 17
	virtual void remove();                                                                         // 18
	virtual void setPos(vec3_t const &);                                                           // 19
	virtual bool isRuntimePredictedMovementEnabled(void);                                          // 20
	virtual struct PredictedMovementValues const &getPredictedMovementValues(void);                // 21
	virtual vec3_t *getPos(void) const;                                                            // 22
	virtual vec3_t *getPosOld(void) const;                                                         // 23
	virtual vec3_t *getPosExtrapolated(float);                                                     // 24
	virtual vec3_t *getAttachPos(enum ActorLocation, float);                                       // 25
	virtual vec3_t *getFiringPos(void);                                                            // 26
	virtual void setRot(vec2_t const &);                                                           // 27
	virtual void move(vec3_t const &);                                                             // 28
	virtual void move(__int64, vec3_t const &);                                                    // 29
	virtual vec3_t getInterpolatedRidingPosition(float);                                           // 30
	virtual float getInterpolatedBodyRot(float);                                                   // 31
	virtual float getInterpolatedHeadRot(float);                                                   // 32
	virtual float getInterpolatedBodyYaw(float);                                                   // 33
	virtual float getYawSpeedInDegreesPerSecond(void);                                             // 34
	virtual float getInterpolatedWalkAnimSpeed(float);                                             // 35
	virtual vec3_t getInterpolatedRidingOffset(float);                                             // 36
	virtual void resetInterpolated();                                                              // 37
	virtual void updateEntityInside(AABB const &);                                                 // 38
	virtual void updateEntityInside();                                                             // 39
	virtual bool isFireImmune() const;                                                             // 40
	virtual void breaksFallingBlocks(void);                                                        // 41
	virtual void blockedByShield(class ActorDamageSource const &, C_Entity *);                     // 42
	virtual void teleportTo(vec3_t const &, bool, int, int);                                       // 43
	virtual bool tryTeleportTo(vec3_t const &, bool, bool, int, int);                              // 44
	virtual void chorusFruitTeleport(vec3_t const &);                                              // 45
	virtual void lerpMotion(vec3_t const &);                                                       // 46
	virtual std::unique_ptr<class AddActorBasePacket> tryCreateAddActorPacket(void);               // 47
	virtual void normalTick(void);                                                                 // 48
	virtual void baseTick(void);                                                                   // 49
	virtual void vehicleTick(void);                                                                // passengerTick() ;                                 // 50
	virtual void positionPassenger(C_Entity *, float);                                             // 51
	virtual float getRidingHeight(void);                                                           // 52
	virtual bool startRiding(C_Entity &);                                                          // 53
	virtual void addPassenger(C_Entity *);                                                         // 54
	virtual void flagPassengerToRemove(C_Entity *);                                                // 55
	virtual std::u8string getExitTip(std::u8string const &, int InputMode) const;                  // 56
	virtual bool intersects(vec3_t const &, vec3_t const &);                                       // 57
	virtual bool isInWall(void);                                                                   // 58
	virtual bool isInvisible(void);                                                                // 59
	virtual bool canShowNameTag(void);                                                             // 60
	virtual bool canExistInPeaceful(void);                                                         // 61
	virtual void setNameTagVisible(bool);                                                          // 62
	virtual TextHolder *getNameTag(void);                                                          // 63
	virtual uint64_t getNameTagAsHash(void);                                                       // 64
	virtual TextHolder *getFormattedNameTag(void);                                                 // 65
	virtual void filterFormattedNameTag(class UIProfanityContext const &);                         // 66
	virtual void setNameTag(TextHolder *);                                                         // 67
	virtual void getAlwaysShowNameTag(void);                                                       // 68
	virtual void setScoreTag(TextHolder *);                                                        // 69
	virtual TextHolder *getScoreTag(void);                                                         // 70
	virtual bool isInWater(void) const;                                                            // 71
	virtual bool hasEnteredWater(void) const;                                                      // 72
	virtual bool isInLava(void) const;                                                             // 73
	virtual bool isUnderLiquid(__int64) const;                                                     // 74
	virtual bool isOverWater(void) const;                                                          // 75
	virtual void setBlockMovementSlowdownMultiplier(vec3_t const &, vec3_t const &);               // 76
	virtual void resetBlockMovementSlowdownMultiplier(void);                                       // 77
	virtual float getCameraOffset(void);                                                           // 78
	virtual float getShadowHeightOffs(void);                                                       // 79
	virtual float getShadowRadius(void);                                                           // 80
	virtual vec3_t getHeadLookVector(float);                                                       // 81
	virtual bool canSeeInvisible(void) const;                                                      // 82
	virtual bool canSee(C_Entity *) const;                                                         // 83
	virtual bool canSee(vec3_t const &) const;                                                     // 84
	virtual bool isSkyLit(float);                                                                  // 85
	virtual float getBrightness(float);                                                            // 86
	virtual void interactPreventDefault(void);                                                     // 87
	virtual void C_PlayerTouch(C_Player &);                                                        // 88
	virtual void onAboveBubbleColumn(bool);                                                        // 89
	virtual void onInsideBubbleColumn(bool);                                                       // 90
	virtual bool isImmobile(void);                                                                 // 91
	virtual bool isSilent(void);                                                                   // 92
	virtual bool isPickable(void);                                                                 // 93
	virtual bool isFishable(void);                                                                 // 94
	virtual bool isSleeping(void) const;                                                           // 95
	virtual void setSleeping(bool);                                                                // 96
	virtual bool isShootable(void);                                                                // 97
	virtual void setSneaking(bool);                                                                // 98
	virtual bool isBlocking(void);                                                                 // 99
	virtual bool isDamageBlocked(__int64 const &);                                                 // 100
	virtual bool isAlive(void);                                                                    // 101
	virtual bool isOnFire(void);                                                                   // 102
	virtual bool isOnHotBlock(void);                                                               // 103
	virtual bool isCreativeModeAllowed(void);                                                      // 104
	virtual bool isSurfaceMob(void);                                                               // 105
	virtual bool isTargetable(void);                                                               // 106
	virtual bool isLocalPlayer(void) const;                                                        // 107
	virtual bool isPlayer(void) const;                                                             // 108
	virtual bool isAffectedByWaterBottle(void);                                                    // 109
	virtual bool canAttack(C_Entity *, bool);                                                      // 110
	virtual void setTarget(C_Entity *);                                                            // 111
	virtual bool findAttackTarget(void);                                                           // 112
	virtual bool isValidTarget(C_Entity *);                                                        // 113
	virtual bool attack(C_Entity *, __int64 const &);                                              // 114
	virtual void performRangedAttack(C_Entity *, float);                                           // 115
	virtual void adjustDamageAmount(int &);                                                        // 116
	virtual int getEquipmentCount(void);                                                           // 117
	virtual void setOwner(__int64 ActorUniqueID);                                                  // 118
	virtual void setSitting(bool);                                                                 // 119
	virtual void onTame(void);                                                                     // 120
	virtual void onFailedTame(void);                                                               // 121
	virtual int getInventorySize(void);                                                            // 122
	virtual int getEquipSlots(void);                                                               // 123
	virtual int getChestSlots(void);                                                               // 124
	virtual void setStanding(bool);                                                                // 125
	virtual bool canPowerJump(void);                                                               // 126
	virtual void setCanPowerJump(bool);                                                            // 127
	virtual bool isJumping(void);                                                                  // 128
	virtual bool isEnchanted(void);                                                                // 129
	virtual void vehicleLanded(vec3_t const &, vec3_t const &);                                    // 130
	virtual bool shouldRender(void);                                                               // 131
	virtual void playAmbientSound(void);                                                           // 132
	virtual class LevelSoundEvent getAmbientSound(void);                                           // 133
	virtual bool isInvulnerableTo(class ActorDamageSource const &);                                // 134
	virtual class ActorDamageCause getBlockDamageCause(C_Block const &);                           // 135
	virtual void actuallyHurt(int, __int64 const &, bool);                                         // 136
	virtual void animateHurt(void);                                                                // 137
	virtual bool doFireHurt(int);                                                                  // 138
	virtual void onLightningHit(void);                                                             // 139
	virtual void onBounceStarted(vec3_ti const &, C_Block const &);                                // 140
	virtual void feed(int);                                                                        // 141
	virtual void handleEntityEvent(class ActorEvent, int);                                         // 142
	virtual float getPickRadius(void);                                                             // 143
	virtual class HashedString const &getActorRendererId(void);                                    // 144
	virtual C_Item *spawnAtLocation(int, int);                                                     // 145
	virtual C_Item *spawnAtLocation(int, int, float);                                              // 146
	virtual C_Item *spawnAtLocation(C_Block const &, int);                                         // 147
	virtual C_Item *spawnAtLocation(C_Block const &, int, float);                                  // 148
	virtual C_Item *spawnAtLocation(C_ItemStack const &, float);                                   // 149
	virtual void despawn(void);                                                                    // 150
	virtual void killed(C_Entity *);                                                               // 151
	virtual void awardKillScore(C_Entity *, int);                                                  // 152
	virtual void setArmor(int ArmorSlot, C_ItemStack const &);                                     // 153
	virtual C_ItemStack *getArmor(int);                                                            // 154
	virtual std::vector<class C_ItemStack const *> getAllArmor(void);                              // 155
	virtual class ArmorMaterialType getArmorMaterialTypeInSlot(int ArmorSlot);                     // 156
	virtual ArmorMaterialType getArmorMaterialTextureTypeInSlot(int ArmorSlot);                    // 157
	virtual float getArmorColorInSlot(int ArmorSlot, int);                                         // 158
	virtual void getEquippedSlot(int);                                                             // 159
	virtual void setEquippedSlot(int EquipmentSlot, C_ItemStack const &);                          // 160
	virtual __int64 getCarriedC_Item(C_ItemStack const *);                                         // 161
	virtual C_ItemStack *setCarriedItem(C_ItemStack const *);                                      // 162
	virtual void setOffhandSlot(C_ItemStack const *);                                              // 163
	virtual C_ItemStack *getEquippedTotem(void);                                                   // 164
	virtual bool consumeTotem(void);                                                               // 165
	virtual bool save(CompoundTag *);                                                              // 166
	virtual void saveWithoutId(CompoundTag &);                                                     // 167
	virtual bool load(CompoundTag const &, class DataLoadHelper &);                                // 168
	virtual void loadLinks(CompoundTag, std::vector<struct ActorLink> &, DataLoadHelper &);        // 169
	virtual int getEntityTypeId(void) const;                                                             // 170
	virtual HashedString const &queryEntityRenderer(void);                                         // 171
	virtual __int64 getSourceUniqueID(void);                                                       // 172
	virtual void thawFreezeEffect(void);                                                           // 173
	virtual bool canFreeze(void);                                                                  // 174
	virtual bool isWearingLeatherArmor(void);                                                      // 175
	virtual AABB getLiquidAABB(class MaterialType);                                                // 176
	virtual void handleInsidePortal(vec3_ti const &);                                              // 177
	virtual int getPortalCooldown(void);                                                           // 178
	virtual int getPortalWaitTime(void);                                                           // 179
	virtual int getDimensionId(int *);                                                             // 180
	virtual bool canChangeDimensions(void);                                                        // 181
	virtual __int64 changeDimension(int, bool);                                                    // 182
	virtual __int64 changeDimension(class AutomaticID);                                            // 183
	virtual __int64 getControllingC_Player(void);                                                  // 184
	virtual __int64 checkFallDamage(float, bool);                                                  // 185
	virtual __int64 causeFallDamage(float, float, __int64);                                        // 186
	virtual __int64 handleFallDistanceOnServer(float, float, bool);                                // 187
	virtual __int64 playSynchronizedSound(__int64, vec3_t const &, C_Block const &, bool);         // 188
	virtual __int64 playSynchronizedSound(__int64, vec3_t const &, int, bool);                     // 189
	virtual __int64 onSynchedFlagUpdate(int, long, long);                                          // 190
	virtual __int64 onSynchedDataUpdate(int);                                                      // 191
	virtual bool canAddPassenger(C_Entity *);                                                      // 192
	virtual bool canPickupC_Item(C_ItemStack const &);                                             // 193
	virtual bool canBePulledIntoVehicle(void);                                                     // 194
	virtual __int64 inCaravan(void);                                                               // 195
	virtual bool isLeashableType(void);                                                            // 196
	virtual __int64 tickLeash(void);                                                               // 197
	virtual __int64 sendMotionPacketIfNeeded(void);                                                // 198
	virtual bool canSynchronizeNewEntity(void);                                                    // 199
	virtual __int64 stopRiding(bool, bool, bool);                                                  // 200
	virtual __int64 startSwimming(void);                                                           // 201
	virtual __int64 stopSwimming(void);                                                            // 202
	virtual __int64 buildDebugInfo(std::u8string &);                                               // 203
	virtual __int64 getCommandPermissionLevel(void);                                               // 204
	virtual bool isClientSide(void);                                                               // 205
	virtual AttributeInstance *getMutableAttribute(Attribute *Attribute) const;                    // 206
	virtual AttributeInstance *getAttribute(Attribute *Attribute) const;                           // 207
	virtual __int64 getDeathTime(void);                                                            // 208
	virtual __int64 heal(int);                                                                     // 209
	virtual bool isInvertedHealAndHarm(void);                                                      // 210
	virtual bool canBeAffected(int);                                                               // 211
	virtual bool canBeAffected(MobEffectInstance const &);                                         // 212
	virtual bool canBeAffectedByArrow(MobEffectInstance const &);                                  // 213
	virtual __int64 onEffectAdded(MobEffectInstance &);                                            // 214
	virtual __int64 onEffectUpdated(MobEffectInstance &);                                          // 215
	virtual __int64 onEffectRemoved(MobEffectInstance &);                                          // 216
	virtual __int64 getAnimationComponent(void);                                                   // 217
	virtual __int64 openContainerComponent(C_Player &);                                            // 218
	virtual __int64 swing(void);                                                                   // 219
	virtual __int64 useC_Item(C_ItemStack &, int, bool);                                           // 220
	virtual bool hasOutputSignal(unsigned char);                                                   // 221
	virtual __int64 getOutputSignal(void);                                                         // 222
	virtual __int64 getDebugText(__int64);                                                         // 223
	virtual __int64 getMapDecorationRotation(void);                                                // 224
	virtual __int64 getPassengerYRotation(C_Entity *);                                             // 225
	virtual __int64 getYHeadRot(void);                                                             // 226
	virtual bool isWorldBuilder(void) const;                                                       // 227
	virtual bool isCreative(void);                                                                 // 228
	virtual bool isAdventure(void);                                                                // 229
	virtual __int64 add(C_ItemStack &);                                                            // 230
	virtual __int64 drop(C_ItemStack const &, bool);                                               // 231
	virtual __int64 getInteraction(C_Player &, __int64 &, vec3_t const &);                         // 232
	virtual bool canDestroyBlock(C_Block const &);                                                 // 233
	virtual __int64 setAuxValue(int);                                                              // 234
	virtual __int64 setSize(float, float);                                                         // 235
	virtual __int64 onOrphan(void);                                                                // 236
	virtual __int64 wobble(void);                                                                  // 237
	virtual bool wasHurt(void);                                                                    // 238
	virtual __int64 startSpinAttack(void);                                                         // 239
	virtual __int64 stopSpinAttack(void);                                                          // 240
	virtual __int64 setDamageNearbyMobs(bool);                                                     // 241
	virtual __int64 renderDebugServerState(__int64);                                               // 242
	virtual __int64 reloadLootTable(void);                                                         // 243
	virtual __int64 reloadLootTable(__int64);                                                      // 244
	virtual __int64 getDeletionDelayTimeSeconds(void);                                             // 245
	virtual __int64 kill(void);                                                                    // 246
	virtual __int64 die(__int64 const &);                                                          // 247
	virtual __int64 shouldDropDeathLoot(void);                                                     // 248
	virtual __int64 shouldTick(void);                                                              // 249
	virtual __int64 extractSnapshot(__int64 &);                                                    // 250
	virtual __int64 applySnapshot(__int64, __int64);                                               // 251
	virtual __int64 getNextStep(float);                                                            // 252
	virtual __int64 getLootTable(void);                                                            // 253
	virtual __int64 interpolatorTick(void);                                                        // 254
	virtual __int64 updateEntitySpecificMolangVariables(__int64);                                  // 255
	virtual __int64 shouldTryMakeStepSound(void);                                                  // 256
	virtual bool canMakeStepSound(void);                                                           // 257
	virtual __int64 _hurt(__int64 const &, int, bool, bool);                                       // 258
	virtual __int64 markHurt(void);                                                                // 259
	virtual __int64 _getAnimationComponent(__int64);                                               // 260
	virtual __int64 readAdditionalSaveData(CompoundTag const &, __int64);                          // 261
	virtual __int64 addAdditionalSaveData(CompoundTag &);                                          // 262
	virtual __int64 _playStepSound(vec3_ti const &, C_Block const &);                              // 263
	virtual __int64 _playFlySound(vec3_ti const &, C_Block const &);                               // 264
	virtual __int64 _makeFlySound(void);                                                           // 265
	virtual __int64 checkInsideBlocks(float);                                                      // 266
	virtual __int64 pushOutOfBlocks(vec3_t const &);                                               // 267
	virtual __int64 updateWaterState(void);                                                        // 268
	virtual __int64 doWaterSplashEffect(void);                                                     // 269
	virtual __int64 spawnTrailBubbles(void);                                                       // 270
	virtual __int64 updateInsideBlock(void);                                                       // 271
	virtual __int64 _removePassenger(__int64 const &, bool, bool, bool);                           // 272
	virtual __int64 _onSizeUpdated(void);                                                          // 273
	virtual __int64 _doAutoAttackOnTouch(C_Entity *);                                              // 274
	virtual __int64 knockback(C_Entity *, int, float, float, float, float, float);                 // 275
	virtual __int64 spawnAnim(void);                                                               // 276
	virtual __int64 setSprinting(bool);                                                            // 277
	virtual __int64 getHurtSound(void);                                                            // 278
	virtual __int64 getDeathSound(void);                                                           // 279
	virtual __int64 getC_ItemInHandIcon(C_ItemStack const &, int);                                 // 280
	virtual uintptr_t getSpeed(void);                                                              // 281
	virtual __int64 setSpeed(float);                                                               // 282
	virtual __int64 getJumpPower(void);                                                            // 283
	virtual __int64 hurtEffects(__int64 const &, int, bool, bool);                                 // 284
	virtual __int64 getMeleeWeaponDamageBonus(C_Entity *);                                         // 285
	virtual __int64 getMeleeKnockbackBonus(void);                                                  // 286
	virtual __int64 travel(float, float, float);                                                   // 287
	virtual __int64 travel(__int64, float, float, float);                                          // 288
	virtual __int64 applyFinalFriction(float, bool);                                               // 289
	// virtual __int64 updateWalkAnim(void) ;                                                                                                                                                                                    // 290
	virtual __int64 aiStep(void);                                                    // 291
	virtual __int64 aiStep(__int64);                                                 // 292
	virtual __int64 pushActors(void);                                                // 293
	virtual __int64 lookAt(C_Entity *, float, float);                                // 294
	virtual bool isLookingAtAnEntity(void);                                          // 295
	virtual __int64 checkSpawnRules(bool);                                           // 296
	virtual __int64 checkSpawnObstruction(void);                                     // 297
	virtual __int64 getAttackAnim(float);                                            // 298
	virtual __int64 getC_ItemUseDuration(void);                                      // 299
	virtual __int64 getC_ItemUseStartupProgress(void);                               // 300
	virtual __int64 getC_ItemUseIntervalProgress(void);                              // 301
	virtual __int64 getC_ItemUseIntervalAxis(void);                                  // 302
	virtual __int64 getTimeAlongSwing(void);                                         // 303
	virtual __int64 ate(void);                                                       // 304
	virtual __int64 getMaxHeadXRot(void);                                            // 305
	virtual bool isAlliedTo(C_Entity *);                                             // 306
	virtual __int64 doHurtTarget(C_Entity *, __int64 const &);                       // 307
	virtual bool canBeControlledByPassenger(void);                                   // 308
	virtual __int64 leaveCaravan(void);                                              // 309
	virtual __int64 joinCaravan(C_Entity *);                                         // 310
	virtual bool hasCaravanTail(void);                                               // 311
	virtual __int64 getCaravanHead(void);                                            // 312
	virtual __int64 getArmorValue(void);                                             // 313
	virtual __int64 getArmorCoverPercentage(void);                                   // 314
	virtual __int64 hurtArmorSlots(__int64 const &, int, std::bitset<4ul> const &);  // 315
	virtual __int64 setDamagedArmor(int, C_ItemStack const &);                       // 316
	virtual __int64 sendArmorDamage(std::bitset<4ul> const &);                       // 317
	virtual __int64 sendArmor(std::bitset<4ul> const &);                             // 318
	virtual __int64 containerChanged(int);                                           // 319
	virtual __int64 updateEquipment(void);                                           // 320
	virtual __int64 clearEquipment(void);                                            // 321
	virtual __int64 getAllArmorID(void);                                             // 322
	virtual __int64 getAllHand(void);                                                // 323
	virtual __int64 getAllEquipment(void);                                           // 324
	virtual __int64 getArmorTypeHash(void);                                          // 325
	virtual __int64 dropEquipmentOnDeath(__int64 const &, int);                      // 326
	virtual __int64 dropEquipmentOnDeath(void);                                      // 327
	virtual __int64 clearVanishEnchantedC_ItemsOnDeath(void);                        // 328
	virtual __int64 sendInventory(bool);                                             // 329
	virtual __int64 getDamageAfterMagicAbsorb(__int64 const &, int);                 // 330
	virtual __int64 createAIGoals(void);                                             // 331
	virtual __int64 onBorn(C_Entity *, C_Entity *);                                  // 332
	virtual __int64 setItemSlot(int, C_ItemStack const &);                           // 333
	virtual __int64 setTransitioningSitting(bool);                                   // 334
	virtual __int64 attackAnimation(C_Entity *, float);                              // 335
	virtual __int64 getAttackTime(void);                                             // 336
	virtual __int64 _getWalkTargetValue(vec3_ti const &);                            // 337
	virtual bool canExistWhenDisallowMob(void);                                      // 338
	virtual __int64 useNewAi(void);                                                  // 339
	virtual __int64 ascendLadder(void);                                              // 340
	virtual __int64 ascendBlockByJumping(void);                                      // 341
	virtual __int64 descendBlockByCrouching(void);                                   // 342
	virtual __int64 dropContainer(void);                                             // 343
	virtual __int64 initBodyControl(void);                                           // 344
	virtual __int64 jumpFromGround(void);                                            // 345
	virtual __int64 jumpFromGround(int);                                             // 346
	virtual __int64 updateAi(void);                                                  // 347
	virtual __int64 newServerAiStep(void);                                           // 348
	virtual __int64 _serverAiMobStep(void);                                          // 349
	virtual __int64 getDamageAfterEnchantReduction(__int64 const &, int);            // 350
	virtual __int64 getDamageAfterArmorAbsorb(__int64 const &, int);                 // 351
	virtual __int64 dropBags(void);                                                  // 352
	virtual __int64 tickDeath(void);                                                 // 353
	virtual __int64 updateGliding(void);                                             // 354
	virtual __int64 _allowAscendingScaffolding(void);                                // 355
	virtual __int64 _getAdjustedAABBForSpawnCheck(AABB const &, vec3_t const &);     // 356
	virtual __int64 prepareRegion(__int64);                                          // 357
	virtual __int64 destroyRegion(void);                                             // 358
	virtual __int64 suspendRegion(void);                                             // 359
	virtual __int64 resendAllChunks(void);                                           // 360
	virtual __int64 _fireWillChangeDimension(void);                                  // 361
	virtual __int64 _fireDimensionChanged(void);                                     // 362
	virtual __int64 changeDimensionWithCredits(int);                                 // 363
	virtual __int64 tickWorld(int const &);                                          // 364
	virtual __int64 frameUpdate(__int64);                                            // 365
	virtual __int64 getTickingOffsets(void);                                         // 366
	virtual __int64 moveView(void);                                                  // 367
	virtual __int64 setName(TextHolder *);                                           // 368
	virtual __int64 checkMovementStats(vec3_t const &);                              // 369
	virtual __int64 getCurrentStructureFeature(void);                                // 370
	virtual bool isAutoJumpEnabled(void);                                            // 371
	virtual __int64 respawn(void);                                                   // 372
	virtual __int64 resetRot(void);                                                  // 373
	virtual __int64 resetPos(bool);                                                  // 374
	virtual bool isInTrialMode(void);                                                // 375
	virtual bool hasResource(int);                                                   // 376
	virtual __int64 completeUsingC_Item(void);                                       // 377
	virtual __int64 setPermissions(void);                                            // 378
	virtual __int64 startDestroying(void);                                           // 379
	virtual __int64 stopDestroying(void);                                            // 380
	virtual __int64 openPortfolio(void);                                             // 381
	virtual __int64 openBook(int, bool, int, __int64 *);                             // 382
	virtual __int64 openTrading(__int64 const &, bool);                              // 383
	virtual bool canOpenContainerScreen(void);                                       // 384
	virtual __int64 openChalkboard(__int64 *, bool);                                 // 385
	virtual __int64 openNpcInteractScreen(std::shared_ptr<__int64>);                 // 386
	virtual __int64 openInventory(void);                                             // 387
	virtual __int64 displayChatMessage(TextHolder *, TextHolder *);                  // 388
	virtual __int64 displayClientMessage(TextHolder *);                              // 389

	virtual __int64 displayTextObjectMessage(__int64 const &, TextHolder *, TextHolder *);          // 390
	virtual __int64 displayTextObjectWhisperMessage(__int64 const &, TextHolder *, TextHolder *);   // 391
	virtual __int64 displayWhisperMessage(TextHolder *, TextHolder *, TextHolder *, TextHolder *);  // 392
	virtual __int64 startSleepInBed(vec3_ti const &);                                               // 393
	virtual __int64 stopSleepInBed(bool, bool);                                                     // 394
	virtual bool canStartSleepInBed(void);                                                          // 395
	virtual __int64 getSleepTimer(void);                                                            // 396
	virtual __int64 getPreviousTickSleepTimer(void);                                                // 397
	virtual __int64 openSign(vec3_ti const &);                                                      // 398
	virtual void playEmote(std::u8string);                                                          // 399
	virtual bool isHostingC_Player(void);                                                           // 400
	virtual bool isLoading(void);                                                                   // 401
	virtual bool isC_PlayerInitialized(void);                                                       // 402
	virtual __int64 stopLoading(void);                                                              // 403
	virtual __int64 registerTrackedBoss(__int64);                                                   // 404
	virtual __int64 unRegisterTrackedBoss(__int64);                                                 // 405
	virtual __int64 setC_PlayerGameType(int);                                                       // 406
	virtual __int64 initHUDContainerManager(void);                                                  // 407
	virtual __int64 _crit(C_Entity *);                                                              // 408
public:
	C_InventoryTransactionManager *getTransactionManager() const;

	inline void setPos_Always(vec3_t const &v) {
		extern bool canSetPos_Hook;
		canSetPos_Hook = true;
		setPos(v);
	}

	inline void setRot_Always(vec2_t const &v) {
		extern bool canSetRot_Hook;
		canSetRot_Hook = true;
		setRot(v);
	}

	inline AABB *getAABB() {
		return &this->aabb;
	}

	inline int64_t getUniqueId() const {
		int64_t *v1;  // rbx
		char v3;      // [rsp+30h] [rbp+8h]

		v1 = (int64_t *)((uintptr_t)this + 256);
		if (*((int64_t *)this + 32) == -1i64)
			*v1 = *(int64_t *)(*(int64_t(__fastcall **)(int64_t, char *))(**((int64_t **)this + 110) + 1960i64))(*((int64_t *)this + 110), &v3);
		return *(int64_t *)v1;
	}

	inline float getRealSpeed() {
		return *reinterpret_cast<float *>(this->getSpeed() + 0x84);
	}

	float getTicksPerSecond() {
		const vec3_t targetPos = *this->getPos();
		const vec3_t targetPosOld = *this->getPosOld();
		return sqrtf(((targetPos.x - targetPosOld.x) * (targetPos.x - targetPosOld.x)) + ((targetPos.z - targetPosOld.z) * (targetPos.z - targetPosOld.z)));
	}

	float getBlocksPerSecond();

	inline int getTicksUsingItem() {
		return this->ticksUsingItem;
	}

	inline bool isSneaking() {
		return false;  // TODO
	}

	inline bool isSprinting() {
		return false;  // TODO
	}

	inline Dimension *getDimension() {
		return *reinterpret_cast<class Dimension **>(reinterpret_cast<uintptr_t>(this) + 0x360);
	}

	inline void SetFieldOfView(float num) {
		*(float *)((uintptr_t)(this) + 0x1040) = num;
	}

	inline float GetFieldOfView() const {
		return *reinterpret_cast<float *>(reinterpret_cast<uintptr_t>(this) + 0x1040);
	}

	inline Level *getlevel() const {
		return *reinterpret_cast<class Level **>(reinterpret_cast<uintptr_t>(this) + 0x368);
	}

	float getHealth() const {
		Attribute *healthAttribute = reinterpret_cast<Attribute *>((Utils::Utils::getBase() + 27118393) + (*(uintptr_t *)((Utils::Utils::getBase() + 27118393) + 3)) + 7);
		return *(float *)(reinterpret_cast<uintptr_t>(getAttribute(healthAttribute)) + 0x84);
	}

	vec3_t getHumanPos() const {
		vec3_t targetPos = this->eyePos0;

		if (getEntityTypeId() == 319)  // if entity is a player; must subtract 1.6 because playerPos is listed as 1.6f higher than real
			return sub(targetPos, 0.f, 1.6f, 0.f);
		return targetPos;
	}

	void lerpTo(vec3_t const &pos, vec2_t const &a2, int a3);

	void cancelHurtAnimation() {
		//*(int *)((uintptr_t)(this) + 0x738) = 10; To make your animatehurt
		//*(int *)((uintptr_t)(this) + 0x73C) = 10;
		//*(int *)((uintptr_t)(this) + 0x740) = 0;
		*(int *)((uintptr_t)(this) + 0x738) = 0;  // To prevent you from hurt animation + red hand
		*(int *)((uintptr_t)(this) + 0x73C) = 10;
		*(int *)((uintptr_t)(this) + 0x740) = 0;
	}

	void spawnDustParticles(int intensity) {
		using spawnDustParticles = void(__fastcall *)(C_Entity *, int);
		static spawnDustParticles spawnParticle = reinterpret_cast<spawnDustParticles>(Utils::Utils::getBase() + 32724560);
		spawnParticle(this, intensity);
	}

	TextHolder *getType() {
		return (TextHolder *)((uintptr_t)(this) + 0x3F8);
	}

	inline std::strong_ordering operator<=> (const C_Entity &ent) const noexcept {
		return getUniqueId() <=> ent.getUniqueId();
	}

	inline bool operator==(const C_Entity &ent) const noexcept {
		return getUniqueId() == ent.getUniqueId();
	}

	// C_Entity* operator*() {

	//}
};
#pragma pack(pop)

class C_ServerPlayer;

class C_Player : public C_Entity {
public:
	C_PlayerInventoryProxy *getSupplies() const;

	C_ItemStack *getSelectedItem() {
		auto supplies = this->getSupplies();
		return supplies->inventory->getItemStack(supplies->selectedHotbarSlot);
	}

	int getSelectedItemId() {
		auto item = getSelectedItem();
		if (item == nullptr || item->item == nullptr)
			return 0;
		if (item->getItem() == nullptr)
			return 0;
		return item->getItem()->itemId;
	}

	virtual __int64 getEventing(void);                                                                   // 409
	virtual __int64 getUserId(void);                                                                     // 410
	virtual __int64 sendEventPacket(__int64);                                                            // 411
	virtual __int64 addExperience(int);                                                                  // 412
	virtual __int64 addLevels(int);                                                                      // 413
	virtual __int64 setContainerData(__int64, int, int);                                                 // 414
	virtual __int64 slotChanged(__int64, __int64, int, C_ItemStack const &, C_ItemStack const &, bool);  // 415
	virtual __int64 inventoryChanged(__int64, int, C_ItemStack const &, C_ItemStack const &, bool);      // 416
	virtual __int64 refreshContainer(__int64);                                                           // 417
	virtual __int64 deleteContainerManager(void);                                                        // 418
	virtual __int64 setFieldOfViewModifier(float);                                                       // 419
	virtual bool is2DPositionRelevant(int, vec3_ti const &);                                             // 420
	virtual bool isActorRelevant(C_Entity *);                                                            // 421
	virtual bool isTeacher(void);                                                                        // 422
	virtual __int64 onSuspension(void);                                                                  // 423
	virtual __int64 onLinkedSlotsChanged(void);                                                          // 424
	virtual __int64 startCooldown(C_Item const *);                                                       // 425
	virtual __int64 getC_ItemCooldownLeft();                                                             // 426
	virtual __int64 getC_ItemCooldownLeft(unsigned long);                                                // 427
	virtual __int64 getMaxC_ItemCooldownLeft(void);                                                      // 428
	virtual bool isItemInCooldown(HashedString const &);                                                 // 429
	virtual __int64 sendInventoryTransaction(C_InventoryTransaction const &);                            // 430
	virtual __int64 sendComplexInventoryTransaction(__int64);                                            // 431
	virtual __int64 sendNetworkPacket(class C_Packet &);                                                 // 432
	virtual __int64 getC_PlayerEventCoordinator(void);                                                   // 433
	virtual __int64 getMoveInputHandler(void);                                                           // 434
	virtual int getInputMode(void);                                                                      // 435
	virtual int getPlayMode(void);                                                                       // 436
	virtual __int64 reportMovementTelemetry(int);                                                        // 437
	virtual bool isSimulated(void);                                                                      // 438
	virtual __int64 getXuid(void);                                                                       // 439
	virtual __int64 getMovementSettings(void);                                                           // 440
	virtual __int64 onMoveC_PlayerPacketNormal(vec3_t const &, vec2_t const &, float);                   // 441
	virtual __int64 _createChunkSource();                                                                // 442
	virtual __int64 _getSpawnChunkLimit(void);                                                           // 443
	virtual __int64 _updateChunkPublisherView(vec3_t const &, float);                                    // 444

	void enchantItem(C_ItemStack &item, int id, int level);
};

class C_ServerPlayer : public C_Player {
};

class C_LocalPlayer : public C_Player {
public:
	void unlockAchievements();

	inline void swingArm() {
		this->swing();
	}
	void applyTurnDelta(vec2_t &viewAngleDelta);
	void setGameModeType(int gma);

	auto getSwingState() {
		static int offset = *reinterpret_cast<int *>(Utils::Utils::getBase() + 33565454 + 2);
		return reinterpret_cast<float *>((uintptr_t)(this) + offset);
	};
};
